﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="CustomerContactSystem.WebForms.Enquiries.Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Enquiries</h1>

<asp:HyperLink ID="CreateNewLink" runat="server" Text="Create New Enquiry" NavigateUrl="~/Enquiries/Create.aspx" CssClass="button"></asp:HyperLink>

<fieldset id="SearchForm" runat="server" class="search-form">
    <legend>Search</legend>
    <span class="info">Leave dates blank to search over all dates.</span>
    
    <asp:Label ID="EnquiryTypesCaption" runat="server" Text="Type:" AssociatedControlID="EnquiryTypes"></asp:Label>
    <asp:DropDownList ID="EnquiryTypes" runat="server">
        <asp:ListItem Value="0">--Any--</asp:ListItem>
        <asp:ListItem Value="1">For Follow Up</asp:ListItem>
        <asp:ListItem Value="2">Resolved at First Point of Contact</asp:ListItem>
    </asp:DropDownList>

    <asp:Label ID="EnquiryIdCaption" runat="server" Text="Enquiry Id:" AssociatedControlID="EnquiryId"></asp:Label>
    <asp:TextBox ID="EnquiryId" runat="server"></asp:TextBox>
    
    <asp:Label ID="FixYourStreetIdCaption" runat="server" Text="Fix Your Street Id:" AssociatedControlID="FixYourStreetId"></asp:Label>
    <asp:TextBox ID="FixYourStreetId" runat="server"></asp:TextBox>

    <asp:Label ID="EnquiryClassificationCaption" runat="server" Text="Classification:" AssociatedControlID="EnquiryClassification"></asp:Label>
    <asp:DropDownList ID="EnquiryClassification" runat="server"></asp:DropDownList>
    
    <asp:Label ID="ReceivedFromDateCaption" runat="server" Text="Received From:" AssociatedControlID="ReceivedFromDate"></asp:Label>
    <asp:TextBox ID="ReceivedFromDate" runat="server" CssClass="date"></asp:TextBox>

    <asp:Label ID="ReceivedToDateCaption" runat="server" Text="Received To:" AssociatedControlID="ReceivedToDate"></asp:Label>
    <asp:TextBox ID="ReceivedToDate" runat="server" CssClass="date"></asp:TextBox>
    
    <asp:Label ID="DeadlineFromCaption" runat="server" Text="Deadline From:" AssociatedControlID="DeadlineFrom"></asp:Label>
    <asp:TextBox ID="DeadlineFrom" runat="server" CssClass="date"></asp:TextBox>

    <asp:Label ID="DeadlineToCaption" runat="server" Text="Deadline To:" AssociatedControlID="DeadlineTo"></asp:Label>
    <asp:TextBox ID="DeadlineTo" runat="server" CssClass="date"></asp:TextBox>
    
    <asp:Label ID="EnquiryStatusCaption" runat="server" Text="Status of Enquiry:" AssociatedControlID="EnquiryStatus"></asp:Label>
    <asp:DropDownList ID="EnquiryStatus" runat="server">
        <asp:ListItem Value="0">All Open and Closed</asp:ListItem>
        <asp:ListItem Value="1">All Open</asp:ListItem>
        <asp:ListItem value="2">Open and Overdue</asp:ListItem>
        <asp:ListItem Value="3">Open and within Deadline</asp:ListItem>
        <asp:ListItem Value="4">All Closed</asp:ListItem>
        <asp:ListItem Value="5">Closed and deadline met</asp:ListItem>
        <asp:ListItem Value="6">Closed and dealine not met</asp:ListItem>   
    </asp:DropDownList>
    
    <asp:Label ID="EnquirySourceCaption" runat="server" Text="Source:" AssociatedControlID="EnquirySource"></asp:Label>
    <asp:DropDownList ID="EnquirySource" runat="server"></asp:DropDownList>
    
    <asp:Label ID="LoggedByDepartmentsCaption" runat="server" Text="Logged By:" AssociatedControlID="LoggedByDepartments"></asp:Label>
    <asp:DropDownList ID="LoggedByDepartments" runat="server"></asp:DropDownList>
    
    <asp:Label ID="LoggedByGroupsCaption" runat="server" Text="" AssociatedControlID="LoggedByGroups"></asp:Label>
    <asp:DropDownList ID="LoggedByGroups" runat="server"></asp:DropDownList>
    
    <asp:Label ID="LoggedByUsersCaption" runat="server" Text="" AssociatedControlID="LoggedByUsers"></asp:Label>
    <asp:DropDownList ID="LoggedByUsers" runat="server"></asp:DropDownList>
    
    <asp:Label ID="ReferredToDepartmentsCaption" runat="server" Text="Currently Referred To:" AssociatedControlID="ReferredToDepartments"></asp:Label>
    <asp:DropDownList ID="ReferredToDepartments" runat="server"></asp:DropDownList>
    
    <asp:Label ID="ReferredToGroupsCaption" runat="server" Text="" AssociatedControlID="ReferredToGroups"></asp:Label>
    <asp:DropDownList ID="ReferredToGroups" runat="server"></asp:DropDownList>
    
    <asp:Label ID="ReferredToUsersCaption" runat="server" Text="" AssociatedControlID="ReferredToUsers"></asp:Label>
    <asp:DropDownList ID="ReferredToUsers" runat="server"></asp:DropDownList>
    
    <asp:Label ID="EverReferredToUsersCaption" runat="server" Text="Ever Referred To/Submitted By:" AssociatedControlID="EverReferredToUsers"></asp:Label>
    <asp:DropDownList ID="EverReferredToUsers" runat="server"></asp:DropDownList>

    <asp:Label ID="CategoriesCaption" runat="server" Text="Categorised as:" AssociatedControlID="Categories"></asp:Label>
    <asp:DropDownList ID="Categories" runat="server"></asp:DropDownList>
    
    <asp:Label ID="MediaOnlyCaption" runat="server" Text="Media Only?:" AssociatedControlID="MediaOnly"></asp:Label>
    <asp:CheckBox ID="MediaOnly" runat="server" />
    
    <asp:Label ID="TagsCaption" runat="server" Text="Tagged with:" AssociatedControlID="Tags"></asp:Label>
    <asp:DropDownList ID="Tags" runat="server"></asp:DropDownList>
     
    <asp:Label ID="OrderByCaption" runat="server" Text="Order By:" AssociatedControlID="OrderBy"></asp:Label>
    <asp:DropDownList ID="OrderBy" runat="server">
        <asp:ListItem Value="0">Date Received</asp:ListItem>
        <asp:ListItem Value="1">Deadline</asp:ListItem>
        <asp:ListItem Value="2">Id Number</asp:ListItem>
    </asp:DropDownList>
    
    <asp:Label ID="OrderByOrderCaption" runat="server" Text="In:" AssociatedControlID="OrderByOrder"></asp:Label>
    <asp:DropDownList ID="OrderByOrder" runat="server">
        <asp:ListItem Value="0">Ascending Order</asp:ListItem>
        <asp:ListItem Value="1">Descending Order</asp:ListItem>
    </asp:DropDownList>
    
    <asp:Button ID="SearchEnquiries" runat="server" Text="Search" CssClass="submit" OnClick="SearchEnquiriesClick" />
</fieldset>
    <asp:Label ID="SearchResultMessage" runat="server" CssClass="error"></asp:Label>
<ul id="PagingList" runat="server" class="paging">
    <li><asp:HyperLink ID="FirstLink" runat="server" Text="First" NavigateUrl="~/Enquiries/Search.aspx" CssClass="button"></asp:HyperLink></li>
    <li><asp:HyperLink ID="PreviousLink" runat="server" Text="Previous" NavigateUrl="~/Enquiries/Search.aspx" CssClass="button"></asp:HyperLink></li>
    <li class="info"><asp:Literal ID="PagingInfo" runat="server">Page 1 of 20</asp:Literal></li>
    <li><asp:HyperLink ID="NextLink" runat="server" Text="Next" NavigateUrl="~/Enquiries/Search.aspx" CssClass="button"></asp:HyperLink></li>
    <li><asp:HyperLink ID="LastLink" runat="server" Text="Last" NavigateUrl="~/Enquiries/Search.aspx" CssClass="button"></asp:HyperLink></li>
</ul>
<asp:HyperLink ID="ExcelLink" runat="server" Target="_blank" CssClass="excel">
    <asp:Image ID="ExcelImage" runat="server" ImageUrl="~/Content/Images/excel.gif" AlternateText="View in Excel" />View in Excel
</asp:HyperLink>

<asp:Repeater ID="EnquiriesList" runat="server" OnItemDataBound="EnquiriesListItemDataBound" EnableViewState="false">
<HeaderTemplate>
<table>
    <thead>
        <tr>
            <th id="CcId">Id</th>
            <th id="Enquiry" class="medium">Enquiry</th>
            <th id="Source">Source</th>
            <th id="Received">Received</th>
            <th id="Deadline">Deadline</th>
            <th id="Department">Department</th>
            <th id="Category">Category</th>
            <th id="Status">Status</th>
            <th id="With">With</th>
            <th id="OptionsHeader" runat="server">Options</th>
        </tr>
    </thead>
    <tbody>
</HeaderTemplate>
<ItemTemplate>
        <tr id="EnquiryRow" runat="server">
            <td id="CcIdCell" runat="server" headers="CcId"><a id='<%#Eval("Id")%>'></a><%#Eval("Id")%></td>
            <td id="EnquiryCell" runat="server" headers="Enquiry" class="enquiry">
                <asp:HyperLink ID="EnquiryLink" runat="server"></asp:HyperLink>
                <asp:Literal ID="EnquiryDetail" runat="server"></asp:Literal>
            </td>
            <td id="SourceCell" runat="server" headers="Source"><%#Eval("Source.SourceName")%></td>
            <td id="ReceivedCell" runat="server" headers="Received"><%#Eval("DateOfEnquiry", "{0:d}")%></td>
            <td id="DeadlineCell" runat="server" headers="Deadline"><%#Eval("Deadline", "{0:d}")%></td>
            <td id="DepartmentCell" runat="server" headers="Department"><%#Eval("Category.Department.DepartmentName")%></td>
            <td id="CategoryCell" runat="server" headers="Category"><%#Eval("Category.CategoryName")%></td>
            <td id="StatusCell" runat="server" headers="Status"><%#Eval("CurrentStatus")%></td>
            <td id="WithCell" runat="server" headers="With"><%#Eval("CurrentReferral.CurrentlyReferredTo.DisplayName")%></td>
            <td id="OptionsCell" runat="server">
                <asp:HyperLink ID="DeleteLink" runat="server" Text="Delete"></asp:HyperLink>                
            </td>
        </tr>
</ItemTemplate>
<FooterTemplate>
    </tbody>
</table>
</FooterTemplate> 
</asp:Repeater>    
</asp:Content>
